var id = getUrlQueryString('index');
$("#sno").attr("value",id);
function getUrlQueryString(names, urls) {
    urls = urls || window.location.href;
    urls && urls.indexOf("?") > -1 ? urls = urls
        .substring(urls.indexOf("?") + 1) : "";
    var reg = new RegExp("(^|&)" + names + "=([^&]*)(&|$)", "i");
    var r = urls ? urls.match(reg) : window.location.search.substr(1)
        .match(reg);
    if (r != null && r[2] != "")
        return unescape(r[2]);
    return null;
};
$("#btn").click(function () {
    var name = $("#name").val();
    var sno = $("#sno").val();
    var sex = $("#sex").val();
    var age = $("#age").val();
    var telephone = $("#telephone").val();
    var email = $("#email").val();
    $.ajax({
        url:"/RuanJianKeShe/updateStudentInfo",
        type:"post",
        data:{
            "msg":"updateStudentInfo",
            "name":name,
            "sno":sno,
            "sex":sex,
            "age": age,
            "telephone":telephone,
            "email":email
        },
        dataType:"json",
        success:function(success){
            alert(success)
        },
        error:function(){
            alert("fail");
        }
    })
    window.history.back();
})
